<template>
  <div class="page-header">
    <div class="header-content">
      <div class="header-left">
        <el-icon v-if="icon" class="header-icon">
          <component :is="icon" />
        </el-icon>
        <div class="header-text">
          <h2 class="header-title">{{ title }}</h2>
          <p v-if="subtitle" class="header-subtitle">{{ subtitle }}</p>
        </div>
      </div>
      <div v-if="$slots.extra" class="header-extra">
        <slot name="extra"></slot>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Component } from 'vue'

defineProps<{
  title: string
  subtitle?: string
  icon?: Component
}>()
</script>

<style scoped>
.page-header {
  margin-bottom: var(--spacing-6);
  padding: var(--spacing-6);
  background: var(--gradient-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  animation: fadeInDown var(--transition-base) var(--ease-out);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  flex: 1;
}

.header-icon {
  font-size: var(--font-size-3xl);
  color: var(--primary-color);
}

.header-text {
  flex: 1;
}

.header-title {
  margin: 0 0 var(--spacing-1) 0;
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.header-subtitle {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

.header-extra {
  display: flex;
  gap: var(--spacing-2);
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-title {
    font-size: var(--font-size-2xl);
  }

  .header-icon {
    font-size: var(--font-size-2xl);
  }
}
</style>
